package cn.wzy.controller;

import cn.wzy.dto.LoginDTO;
import cn.wzy.dto.SmsCodeDto;
import cn.wzy.results.ResponseResult;
import cn.wzy.service.VerifyCodeService;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;
import java.util.HashMap;
import java.util.Map;

@RestController
@RequestMapping("/verifyCode")
public class VerifyCodeController {

    @Resource
    private VerifyCodeService verifyCodeService;

    @GetMapping("/image/{imageCodeKey}")
    public ResponseResult getImgCode(@PathVariable("imageCodeKey") String imageCodeKey){
        return verifyCodeService.getImgCode(imageCodeKey);
    }

    @PostMapping("/sms/register")
    public ResponseResult sendSmsCodeRegister(@RequestBody SmsCodeDto smsCodeDto){
        return verifyCodeService.sendSmsCodeRegister(smsCodeDto);
    }

    @PostMapping("/sms/login")
    public ResponseResult sendSmsCodeLogin(@RequestBody LoginDTO loginDTO){
        return verifyCodeService.sendSmsCodeLogin(loginDTO);
    }

    /*
    * wx绑定手机验证码
    * */
    @PostMapping("/sms/bind")
    public ResponseResult sendSmsCodeBindWx(@RequestBody HashMap<String,String> param){
        return verifyCodeService.sendSmsCodeBindWx(param);
    }
}
